package com.atguigu.serviceedu.controller.site;

import com.atguigu.serviceedu.entity.EduTeacher;
import com.atguigu.serviceedu.service.EduTeacherService;
import com.atguigu.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("/site/eduteacher")
public class SiteTeacherController {
    @Autowired
    private EduTeacherService eduTeacherService;
    @GetMapping("/getTeacherAll")
    public ResultVO getTeacherAll(){
        List<EduTeacher> teachers = eduTeacherService.list(null);
        return ResultVO.ok().Msg("获取所有讲师成功").Data("teachers",teachers);
    }
    @GetMapping("/getTeacherInfoById/{id}")
    public ResultVO getTeacherInfoById(@PathVariable("id")String id){
        Map<String, Object> map = eduTeacherService.queryTeacherInfoById(id);
        return ResultVO.ok().Msg("查询讲师信息成功").Data("info",map);
    }
}
